import java.util.Scanner;

/*
    整数小拼接
 */
public class IntegerSmallSplicing {
    public static void main(String[] args) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr [] = new int [n];
        int K =sc.nextInt();
        for (int i = 0; i < n; i++) {
            arr[i]=sc.nextInt();
        }
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length; j++) {
                String temp1 = (""+arr[i]+arr[j]);
                String temp2 = (""+arr[j]+arr[i]);
                if (Integer.parseInt(temp1)<=K) {
                    count++;
                }
                if (Integer.parseInt(temp2)<=K) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }

}
